package com.sui.bigdata.rtcadmin.controller;

import com.sui.bigdata.rtcadmin.model.vo.CommonResponse;
import com.sui.bigdata.rtcadmin.service.KafkaTopicService;
import com.sui.bigdata.rtcadmin.util.CheckUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

/**
 * @Author yanjiantong
 * @Date 2019/12/31 15:51
 * @Description
 * @email jiantong_yan@sui.com
 */

@RestController
@CrossOrigin
@RequestMapping(value = "/topic")
@Slf4j
public class KafkaTopicController extends BaseController{

    @Autowired
    private KafkaTopicService kafkaTopicService;

    @GetMapping("/all")
    public CommonResponse all() {
        return CommonResponse.Builder.buildSuccess(kafkaTopicService.queryAllTopic());
    }

    @GetMapping
    public CommonResponse one(@RequestParam("topicName")String topicName) {
        return CommonResponse.Builder.buildSuccess(kafkaTopicService.queryByTopicName(topicName));

    }

}
